<?xml version="1.0" encoding="UTF-8"?>
<!--
 表 : ${tableName}
 注释 : ${comment}
 @author ${author!"liuwb"}
 @since ${data!.now?datetime}
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${mapperPackage}.${className}Mapper">
    <!--字段映射-->
    <resultMap id="ResultMap" type="${entityPackage}.${className}">
        <#list properties as p>
            <#if p.isKey==true>
                <id column="${p.columnName}" property="${p.name}"/>
            <#else>
                <result column="${p.columnName}" property="${p.name}"/>
            </#if>
        </#list>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="ColumnList">
        <#list properties as field><#if field_index!=(properties?size - 1)>${field.columnName}, <#else>${field.columnName}</#if></#list>
    </sql>

    <!-- 通用别名查询结果列 -->
    <sql id="ColumnListAlias">
        <#list properties as field>${alias}.<#if field_index!=(properties?size - 1)>${field.columnName}, <#else>${field.columnName}</#if></#list>
    </sql>

    <!-- 通用别名查询详情结果列 -->
    <sql id="ColumnDetails">
        <#list properties as field>${alias}.<#if field_index!=(properties?size - 1)>${field.columnName} ${tableName}_${field.columnName}, <#else>${field.name} ${tableName}_${field.columnName}</#if></#list>
    </sql>

</mapper>
